import { useEffect, useState } from 'react';
import { Table } from 'antd';

const AntdTable = () => {
	const [data, setData] = useState([]);

	useEffect(() => {
		const list = [];
		for (let i = 1; i <= 20; i++) {
			list.push({ id: i, title: `标题标题标题标题标题标题标题标题${i}`, status: i % 2 });
		}
		// console.log(list);
		setData(list);
	}, []);

	return (
		<Table
			scroll={{ y: 500 }}
			columns={[
				{
					title: '标题',
					key: 'title',
					dataIndex: 'title',
					width: 100,
					ellipsis: true,
					fixed: 'left'
				},
				{ title: '地址', key: 'address', dataIndex: 'address', fixed: 'left', width: 100 },
				{ title: 'a', key: 'a', dataIndex: 'a', width: 100 },
				{ title: 'b', key: 'b', dataIndex: 'b', width: 100 },
				{ title: 'c', key: 'c', dataIndex: 'c', width: 100 },
				{ title: 'd', key: 'd', dataIndex: 'd', width: 100 },
				{ title: 'e', key: 'e', dataIndex: 'e', width: 100 },
				{ title: 'f', key: 'f', dataIndex: 'f', width: 100 },
				{ title: '状态', key: 'status', dataIndex: 'status', width: 100 }
			]}
			dataSource={data}
		/>
	);
};

export default AntdTable;
